{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 43.统计分析"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 43.1 业务理解"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 43.2 数据读入"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "C:\\Users\\soloman\\clm\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "os.chdir(r'C:\\Users\\soloman\\clm')\n",
    "\n",
    "print(os.getcwd())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "   height  weight\n",
      "1      58     115\n",
      "2      59     117\n",
      "3      60     120\n",
      "4      61     123\n",
      "5      62     126\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import numpy as np    \n",
    "df_women = pd.read_csv('women.csv', index_col=0)\n",
    "\n",
    "print(df_women.head())\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 43.3 数据理解"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(15, 2)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_women.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Index(['height', 'weight'], dtype='object')\n"
     ]
    }
   ],
   "source": [
    "print(df_women.columns)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>height</th>\n",
       "      <th>weight</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>15.000000</td>\n",
       "      <td>15.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>65.000000</td>\n",
       "      <td>136.733333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>4.472136</td>\n",
       "      <td>15.498694</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>58.000000</td>\n",
       "      <td>115.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>61.500000</td>\n",
       "      <td>124.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>65.000000</td>\n",
       "      <td>135.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>68.500000</td>\n",
       "      <td>148.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>72.000000</td>\n",
       "      <td>164.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          height      weight\n",
       "count  15.000000   15.000000\n",
       "mean   65.000000  136.733333\n",
       "std     4.472136   15.498694\n",
       "min    58.000000  115.000000\n",
       "25%    61.500000  124.500000\n",
       "50%    65.000000  135.000000\n",
       "75%    68.500000  148.000000\n",
       "max    72.000000  164.000000"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_women.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD8CAYAAAB5Pm/hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAEQVJREFUeJzt3W2MXOV5xvH/XQiIRE1N66XBbzFEgARRBGihqSgpJGp4UYSpqkpGrUKTVi4JREokSLCQAlKFRHAqlCoqkpO4FImASEVcVJJCKGr4EoeuMe/FjRNMvGtSm1KDFFwS4O6HOYPH65md8e7OnDmP/z9p5dlnzq4vbXyuDM85e09kJpKkcv1G3QEkScNl0UtS4Sx6SSqcRS9JhbPoJalwFr0kFc6il6TCWfSSVDiLXpIKd3TdAQCWLl2aq1evrjuGJDXK1q1bX87MiX7HjUXRr169mqmpqbpjSFKjRMSLgxzn1o0kFc6il6TCWfSSVDiLXpIKZ9FLUuHG4q4bSTrSbN42w4YHt7N7336WLTmO6y46jcvPWj6Uv8uil6QR27xthvX3Pc3+X78FwMy+/ay/72mAoZS9WzeSNGIbHtz+Tsm37f/1W2x4cPtQ/j6LXpJGbPe+/Ye1vlAWvSSN2LIlxx3W+kJZ9JI0YtdddBrHveuog9aOe9dRXHfRaUP5+7wYK0kj1r7g6l03klSwy89aPrRin82tG0kqnEUvSYWz6CWpc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YL3yZuZDmflmddgWYEVdGdvm+NkC3AZ8kda/ibEwR97PALdk5hvV+p76UrbMkXXszrEuPgb8NDNfZEzPsw7vZB3FOdbEok/goYjYGhHrqrXPAxsiYhfwVWB9bekOOBnYC/xDRGyLiG9GxHuA383MlwCqP0+oM2SHXnk7fRr4/uijHaJr1oi4DJjJzCdrzjdbr5/tqcD5EfHjiPhhRJxTb0ygd9ZxPMdmWwvcXT0e1/OsrTNrp6GcY00s+vMy82zgEuDqiPgIrVdGX8jMlcAXqF6N1Oxo4Gzg9sw8C/glrf+EHFdz5o2IG4A3gbvqiXeQbllvAm4Avlxjrl56/WyPBo4HPgxcB9wbEVFbypZeWcfxHHtHRBwDXAZ8p+4s/fTKOtRzrO69qgXuc90EXAu8yoFbRQN4bQyyvQ/Y2fH5+cADwHbgxGrtRGB73Vnnyls9vhL4EfDuunPOkfXfgD20ruHsrE6YnwPvG9O8DwD/ClzQsf5TYGJMs47dOTYr9xrgoY7Px/I865a1WhvqOdaoV/TVf57/ZvsxrYsYz9DaL/zD6rCPAj+pJ+EBmfkLYFdEtN+t/GPAc8D9tP5Hpfrzn2uId4heeSPiYuBLwGWZ+XptATv0yPp4Zp6QmaszczUwDZxdHVurOf4tbKb175WIOJXWhc9ah3HNkXXszrFZruDgrZCxPM8qB2UdxTnWqF+YioiTge9Wnx4NfDszb46IPwC+Vq39H/DZzNxaU8x3RMSZwDdpncA/Az5Fa7vsXmAVrVecf5qZr9QWskOPvP8BHAv8T3XYlsy8qp6EB3TLmpn/2/H8TmAyM8diimGPn+0vgU3AmcCvgGsz85HaQlZ6ZD2DMTzHACLi3cAu4OTMfLVa+x3G8DzrkXUHQz7HGlX0kqTD16itG0nS4bPoJalwFr0kFc6il6TCWfSSVDiLXpIKZ9FLUuEsekkq3P8DADk25OLJuPkAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1a86c8345f8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline\n",
    "plt.scatter(df_women[\"height\"], df_women[\"weight\"])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 43.4 数据准备"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "X = df_women[\"height\"]\n",
    "y = df_women[\"weight\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1     58\n",
       "2     59\n",
       "3     60\n",
       "4     61\n",
       "5     62\n",
       "6     63\n",
       "7     64\n",
       "8     65\n",
       "9     66\n",
       "10    67\n",
       "11    68\n",
       "12    69\n",
       "13    70\n",
       "14    71\n",
       "15    72\n",
       "Name: height, dtype: int64"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1     115\n",
       "2     117\n",
       "3     120\n",
       "4     123\n",
       "5     126\n",
       "6     129\n",
       "7     132\n",
       "8     135\n",
       "9     139\n",
       "10    142\n",
       "11    146\n",
       "12    150\n",
       "13    154\n",
       "14    159\n",
       "15    164\n",
       "Name: weight, dtype: int64"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 43.5 模型类型的选择与超级参数的设置"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Anaconda\\lib\\site-packages\\statsmodels\\compat\\pandas.py:56: FutureWarning: The pandas.core.datetools module is deprecated and will be removed in a future version. Please use the pandas.tseries module instead.\n",
      "  from pandas.core import datetools\n"
     ]
    }
   ],
   "source": [
    "import statsmodels.api as sm"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1     58\n",
       "2     59\n",
       "3     60\n",
       "4     61\n",
       "5     62\n",
       "6     63\n",
       "7     64\n",
       "8     65\n",
       "9     66\n",
       "10    67\n",
       "11    68\n",
       "12    69\n",
       "13    70\n",
       "14    71\n",
       "15    72\n",
       "Name: height, dtype: int64"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>const</th>\n",
       "      <th>height</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1.0</td>\n",
       "      <td>58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1.0</td>\n",
       "      <td>59</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1.0</td>\n",
       "      <td>60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1.0</td>\n",
       "      <td>61</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>1.0</td>\n",
       "      <td>62</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>1.0</td>\n",
       "      <td>63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>1.0</td>\n",
       "      <td>64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>1.0</td>\n",
       "      <td>65</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>1.0</td>\n",
       "      <td>66</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>1.0</td>\n",
       "      <td>67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>1.0</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>1.0</td>\n",
       "      <td>69</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>1.0</td>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>1.0</td>\n",
       "      <td>71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>1.0</td>\n",
       "      <td>72</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    const  height\n",
       "1     1.0      58\n",
       "2     1.0      59\n",
       "3     1.0      60\n",
       "4     1.0      61\n",
       "5     1.0      62\n",
       "6     1.0      63\n",
       "7     1.0      64\n",
       "8     1.0      65\n",
       "9     1.0      66\n",
       "10    1.0      67\n",
       "11    1.0      68\n",
       "12    1.0      69\n",
       "13    1.0      70\n",
       "14    1.0      71\n",
       "15    1.0      72"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_add_const=sm.add_constant(X) \n",
    "X_add_const"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "myModel = sm.OLS(y, X_add_const)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 43.6 训练具体模型及查看其统计量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                            OLS Regression Results                            \n",
      "==============================================================================\n",
      "Dep. Variable:                 weight   R-squared:                       0.991\n",
      "Model:                            OLS   Adj. R-squared:                  0.990\n",
      "Method:                 Least Squares   F-statistic:                     1433.\n",
      "Date:                Sun, 19 Aug 2018   Prob (F-statistic):           1.09e-14\n",
      "Time:                        20:03:13   Log-Likelihood:                -26.541\n",
      "No. Observations:                  15   AIC:                             57.08\n",
      "Df Residuals:                      13   BIC:                             58.50\n",
      "Df Model:                           1                                         \n",
      "Covariance Type:            nonrobust                                         \n",
      "==============================================================================\n",
      "                 coef    std err          t      P>|t|      [0.025      0.975]\n",
      "------------------------------------------------------------------------------\n",
      "const        -87.5167      5.937    -14.741      0.000    -100.343     -74.691\n",
      "height         3.4500      0.091     37.855      0.000       3.253       3.647\n",
      "==============================================================================\n",
      "Omnibus:                        2.396   Durbin-Watson:                   0.315\n",
      "Prob(Omnibus):                  0.302   Jarque-Bera (JB):                1.660\n",
      "Skew:                           0.789   Prob(JB):                        0.436\n",
      "Kurtosis:                       2.596   Cond. No.                         982.\n",
      "==============================================================================\n",
      "\n",
      "Warnings:\n",
      "[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Anaconda\\lib\\site-packages\\scipy\\stats\\stats.py:1394: UserWarning: kurtosistest only valid for n>=20 ... continuing anyway, n=15\n",
      "  \"anyway, n=%i\" % int(n))\n"
     ]
    }
   ],
   "source": [
    "results = myModel.fit()\n",
    "print(results.summary())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "const    -87.516667\n",
       "height     3.450000\n",
       "dtype: float64"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results.params"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 43.7 模型优度的评价"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.9910098326857505"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results.rsquared"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 43.8 建模前提假定条件的讨论"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.0909729585997682e-14"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results.f_pvalue"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.3153803748621851"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sm.stats.stattools.durbin_watson(results.resid)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1.6595730644309743,\n",
       " 0.4361423787323869,\n",
       " 0.7893583826332262,\n",
       " 2.5963042257390008)"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sm.stats.stattools.jarque_bera(results.resid)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([112.58333333, 116.03333333, 119.48333333, 122.93333333,\n",
       "       126.38333333, 129.83333333, 133.28333333, 136.73333333,\n",
       "       140.18333333, 143.63333333, 147.08333333, 150.53333333,\n",
       "       153.98333333, 157.43333333, 160.88333333])"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y_predict=results.predict()\n",
    "y_predict"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 43.9 模型的优化与重新选择"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Text(0,0.5,'体重')"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYMAAAEUCAYAAADJB1rpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzt3XecFPX9x/HXh+NogjQRBUUUUcSC5RBRULChoLEHE9TYfsYWY8OALWosKGqMGoxETYglFkRsINgQLKgQVFQgiv2QiODRy5XP74/vnCzLVWB3dvfez8fjHtzMzsx+drmZz3zrmLsjIiJ1W724AxARkfgpGYiIiJKBiIgoGYiICEoGIiKCkoGIiKBkILVgZq3NrH7ccWQqM7MK1m2y70vfv6SSkoEAYGb9zWxcRRe0BBOBTkn7XWNmQyo55kVmdmHCci8ze3IDYmtpZq0rWL+/mV29AccrMLPZZtagFvtc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0B8KYhpei5XrAbHfPyFG5IqBkIFIjZjYaGMe688Jc5+4FZtaVMJiptMKdIQ8Y5+5fVvK6SOyUDERqwMweJ8xnsyphdTt375qwzQdA4lQX+cAX7n5qeqIU2XBxPvZSJNvcAMxLWB5hZgcBi9x9JmFUa+KMuHpuhmQNJQORmuvFurNxbgcMZu18RwCdkncys0OA49VmIJlMyUCkCmbWDRhFmC5kJ2ANYIRZL+sTJkFsBhS5+7HRA4ryot3d3Z+N2htUHysZTV1LRarg7h+6+57uvrW77w1cQmg3uA6Y5e4lrHuhv4DQblDEus9NUDKQjKaSgUg1ornkDwcGEubAH+ju883svPJNEjZvSEgUsLZ3UeLrIhlJyUCkCma2LTAaeAI4y90XmdlmZvYeUP4ApfJqIdy9b9L+gwhtC0vTFLLIBlHXUpENYGatatIgbGZ57l7Z+AORjKFkICIiakAWERElAxERQclARERQMhAREZQMREQE+H+OmdhP4a8w8QAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1a87139a7b8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.rcParams['font.family']=\"simHei\" #汉字显示\n",
    "plt.plot(df_women[\"height\"], df_women[\"weight\"],\"o\")\n",
    "plt.plot(df_women[\"height\"], y_predict)\n",
    "plt.title('女性体重与身高的线性回归分析')\n",
    "plt.xlabel('身高')\n",
    "plt.ylabel('体重')   "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np    \n",
    "df_women = pd.read_csv('women.csv', index_col=0)\n",
    "X = df_women[\"height\"]\n",
    "y = df_women[\"weight\"]\n",
    "\n",
    "X=np.column_stack((X, np.power(X,2), np.power(X,3)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1.00000e+00, 5.80000e+01, 3.36400e+03, 1.95112e+05],\n",
       "       [1.00000e+00, 5.90000e+01, 3.48100e+03, 2.05379e+05],\n",
       "       [1.00000e+00, 6.00000e+01, 3.60000e+03, 2.16000e+05],\n",
       "       [1.00000e+00, 6.10000e+01, 3.72100e+03, 2.26981e+05],\n",
       "       [1.00000e+00, 6.20000e+01, 3.84400e+03, 2.38328e+05],\n",
       "       [1.00000e+00, 6.30000e+01, 3.96900e+03, 2.50047e+05],\n",
       "       [1.00000e+00, 6.40000e+01, 4.09600e+03, 2.62144e+05],\n",
       "       [1.00000e+00, 6.50000e+01, 4.22500e+03, 2.74625e+05],\n",
       "       [1.00000e+00, 6.60000e+01, 4.35600e+03, 2.87496e+05],\n",
       "       [1.00000e+00, 6.70000e+01, 4.48900e+03, 3.00763e+05],\n",
       "       [1.00000e+00, 6.80000e+01, 4.62400e+03, 3.14432e+05],\n",
       "       [1.00000e+00, 6.90000e+01, 4.76100e+03, 3.28509e+05],\n",
       "       [1.00000e+00, 7.00000e+01, 4.90000e+03, 3.43000e+05],\n",
       "       [1.00000e+00, 7.10000e+01, 5.04100e+03, 3.57911e+05],\n",
       "       [1.00000e+00, 7.20000e+01, 5.18400e+03, 3.73248e+05]])"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_add_const=sm.add_constant(X) \n",
    "\n",
    "X_add_const"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "myModel_updated = sm.OLS(y, X_add_const)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                            OLS Regression Results                            \n",
      "==============================================================================\n",
      "Dep. Variable:                 weight   R-squared:                       1.000\n",
      "Model:                            OLS   Adj. R-squared:                  1.000\n",
      "Method:                 Least Squares   F-statistic:                 1.679e+04\n",
      "Date:                Sun, 19 Aug 2018   Prob (F-statistic):           2.07e-20\n",
      "Time:                        20:03:14   Log-Likelihood:                 1.3441\n",
      "No. Observations:                  15   AIC:                             5.312\n",
      "Df Residuals:                      11   BIC:                             8.144\n",
      "Df Model:                           3                                         \n",
      "Covariance Type:            nonrobust                                         \n",
      "==============================================================================\n",
      "                 coef    std err          t      P>|t|      [0.025      0.975]\n",
      "------------------------------------------------------------------------------\n",
      "const       -896.7476    294.575     -3.044      0.011   -1545.102    -248.393\n",
      "x1            46.4108     13.655      3.399      0.006      16.356      76.466\n",
      "x2            -0.7462      0.211     -3.544      0.005      -1.210      -0.283\n",
      "x3             0.0043      0.001      3.940      0.002       0.002       0.007\n",
      "==============================================================================\n",
      "Omnibus:                        0.028   Durbin-Watson:                   2.388\n",
      "Prob(Omnibus):                  0.986   Jarque-Bera (JB):                0.127\n",
      "Skew:                           0.049   Prob(JB):                        0.939\n",
      "Kurtosis:                       2.561   Cond. No.                     1.25e+09\n",
      "==============================================================================\n",
      "\n",
      "Warnings:\n",
      "[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.\n",
      "[2] The condition number is large, 1.25e+09. This might indicate that there are\n",
      "strong multicollinearity or other numerical problems.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Anaconda\\lib\\site-packages\\scipy\\stats\\stats.py:1394: UserWarning: kurtosistest only valid for n>=20 ... continuing anyway, n=15\n",
      "  \"anyway, n=%i\" % int(n))\n"
     ]
    }
   ],
   "source": [
    "results_updated = myModel_updated.fit()\n",
    "print(results_updated.summary())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "查看斜率及截距项:  const   -896.747633\n",
      "x1        46.410789\n",
      "x2        -0.746184\n",
      "x3         0.004253\n",
      "dtype: float64\n"
     ]
    }
   ],
   "source": [
    "print('查看斜率及截距项: ',results_updated.params)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([114.63856209, 117.40676937, 120.18801264, 123.00780722,\n",
       "       125.89166846, 128.86511168, 131.95365223, 135.18280543,\n",
       "       138.57808662, 142.16501113, 145.9690943 , 150.01585147,\n",
       "       154.33079796, 158.93944911, 163.86732026])"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y_predict_updated=results_updated.predict()\n",
    "y_predict_updated"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Text(0,0.5,'体重')"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYMAAAEUCAYAAADJB1rpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzt3XecVNX5x/HPwxY6UkXpvSkguCIoKEYMKiZR1FgjVmxJLNH8NNYYY0NNjIlGrGgSFRWxC6hRsKEQEKR3dAFp7i5ll23P7497F2aHbZTZ2Z39vl8vXszcuXfuMzN7z3PvOeeeY+6OiIjUbLXiHYCIiMSfkoGIiCgZiIiIkoGIiKBkICIiKBmIiAhKBjWamTUzs+R4x1FTmZmVsGy//R76fWVPKBkkKDM72czeLanAiTAZ6By13W1mdlM5751mZgvNLHUP4vm1mfUrZ52jzOzWPXjP35rZryOeDzaz8RXdPmK7JmbWrIR465jZR2bW28xuNLNGZvaEmR1TyvucZWYd92DXA81sStSyT8ysf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Nvqgmsqu+uwGVL3faCnQKXycRjBe1CvAze6+L2NHxUJ0rN8AV5vZx8BhZvZUvAIrRXS8x7H7d11VRMeaCfQOj7kjqVrHGLBbAbuVqn2cDQGmu7uHDcYxP8aq2hewv9wFvADMBr4AzgCuMbNtBF/yY3GMLVr0QdWBXZesfYGVlR9SmZ4muBqYSlCNsRHoD9wSNs6dFdfoiouO9ZSIeuPZ7n5pXKPbXXS8HaKePxjH2KJFx/pXghujMoGmwItxjK00OwtYYCZV+zgbTnBiCHAJlXCM6aazODOzhsAzBJepKcDZwJvAh8BJwEB3z4xfhCKJwczuAWa4+wQza0TQkKzjLKRkUAWZWRPgBGBqWH0kIvuZjrPilAxERCRh2wxERGQPKBmIiIiSgcieMLPjwi6KZa3TxMzqVVZMIvuD2gxEKiAca6cLcD/BjUsAO9x9ipm1JOgeXHQw/R/BPQ3vh89rAQvdvUrelSsCSgYiFWJmrwLvUnxcmDvdPc3MehHczFRQyuZJwLvuviLGYYrsNSUDkQows5cIxrPJiVjcyt17RawzG4gc6iIFWO7uv6qcKEX2XnK8AxCpRu4C1kQ8f8zMjgU2u/tcgrtaI0fE1bwZUm0oGYhU3GCKj8bZHriRXeMdAXSO3sjMjgdGqs1AqjIlA5EymFlfYBzBcCHdgFzACEa9TCYYBLEhkOHup4YTFCWFm7u7vxG2N6g+Vqo0dS0VKYO7f+Puh7n7we7eH7iOoN3gTmCBu+dTvKC/mqDdIIPi8yYoGUiVpisDkXKEY8n/FDiLYAz8s9x9nZldWbRKxOq1CRIF7OpdFPm6SJWkZCBSBjNrC7wKvAxc4u6bzay+mX0FFE2gVFQthLsfF7X9eQRtC1sqKWSRvaKupSJ7wcyaVqRB2MyS3L20+w9EqgwlAxERUQOyiIgoGYiICEoGIiKCkoGIiKBkICIiwP8DQyYqKxUBqvkAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1a87130b2b0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.rcParams['font.family']=\"simHei\" \n",
    "plt.scatter(df_women[\"height\"], df_women[\"weight\"])\n",
    "plt.plot(df_women[\"height\"], y_predict_updated)\n",
    "plt.title('女性身高与体重数据的线性回归分析')\n",
    "plt.xlabel('身高')\n",
    "plt.ylabel('体重')   "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 43.10 模型的应用"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([130.39340008])"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "h=63.5\n",
    "results_updated.predict([1,h,np.power(h,2),np.power(h,3)])"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [default]",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
